//
//  LFTMCUtil.h
//  Pods
//
//  Created by Thomas Quan on 2017/5/11.
//
//

#import <Foundation/Foundation.h>
#import "NIMMessageModel.h"
#import "LofterMvpCourseTeamModel.h"
#import "LofterMvpCourseDataSource.h"
#import "LFTMCSessionViewController.h"

typedef NS_ENUM(NSInteger, LFTMCStatus) {
    LFTMCStatusNormal,
    LFTMCStatusPersonMuted,
    LFTMCStatusTeamMuted,
    LFTMCStatusCourseEnded
};

typedef NS_ENUM(NSInteger, LFTMCIdentity) {
    LFTMCIdentityNomal,
    LFTMCIdentityTeacher,
    LFTMCIdentityAssistans,
    LFTMCIdentityManager,
    LFTMCIdentityTeamOwner,
};

static NSString *const teamInfoUpdate = @"onTeamInfoUpdate";


static NSString *const kTagTeachers  = @"teachers";
static NSString *const kTagAssistans = @"assistants";
static NSString *const kTagStatus    = @"status";

@interface LFTMCUtil : NSObject

@property (nonatomic, strong) LofterMvpCourseTeamModel *teamModel;

@property (nonatomic, weak) id<LofterMvpCourseDataSource> dataSource;

@property (nonatomic, weak) LFTMCSessionViewController *lftmcVC;

@property (nonatomic, strong) NSArray *mutedMembers;

@property (nonatomic, strong) NIMTeamMember *myTeamInfo;

@property (nonatomic, strong) NSDictionary *customInfo;

+ (instancetype)sharedInstance;

- (LFTMCIdentity)identityFor:(NSString *)someone inSession:(NSString *)sessionId;

- (LFTMCSessionViewController *)lftmcSessionViewController;

+ (BOOL)isMe:(NSString *)uid;

+ (void)setTeacherIds:(nullable NSArray *)tIds inSession:(NSString *)sessionId;

+ (NSArray *)teachersBySessionId:(NSString *)sessionId;

+ (BOOL)shouldOnlySeeTeacherBySessionId:(NSString *)sessionId;

+ (void)setOnlySeeTeacher:(BOOL)flag inSession:(NSString *)sessionId;

+ (NSArray<NIMMessage *> *)removeNotifications:(NSArray<NIMMessage *> *)messages;

+ (NSArray *)filterMessages:(NSArray<NIMMessage *> *)messages
                  SessionId:(NSString *)sessionId
                isNeedModel:(BOOL)isNeedModel;

+ (BOOL)isOwnerOrManager:(NIMTeamMember *)member;

+ (LFTMCStatus)statusForTeamByModel:(LofterMvpCourseTeamModel *)teamModel
                       mutedMembers:(NSArray *)members;

+ (nullable NSDictionary *)stringToDictionary:(nonnull NSString *)string;

+ (NSString *)textByStatus:(LFTMCStatus) status;

+ (NSString *)titleMaker: (NSString *)title;

+ (UIImage *)scaleFromeImage:(UIImage *)image
                      toSize:(CGSize)size;

+ (CGSize)scaredImageWithImageOriginSize:(CGSize)imageSize
                                 maxSize:(CGSize)maxSize;

+ (BOOL)shouldScrollToButtom:(UIScrollView *)scrollView;

@end
